﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using PlaneWar.Controls;

namespace PlaneWar.Helper
{
    public class Myplane_Helper : INotifyPropertyChanged
    {
        private Control_MyPlane view;
        public Myplane_Helper(double x, double y, int blood, bool isdead, Control_MyPlane view, double w, double h)
        {
            this.Top = y;   //y轴
            this.Left = x;   //X轴
            this.blood = blood;   //血液（生命）
            this.view = view;   //页面
            this.height = h;
            this.width = w;
            view.DataContext = this;
            IsDead = isdead;   //
            IsProtect = false;
        }


        static double x = 300;//自己飞机初始位置
        static double y = 420;//自己飞机初始位置

        public void Init()
        {
            Left = 300;
            Top = 420;
            IsDead = false;
            Vis = System.Windows.Visibility.Visible;
        }

        private int blood;
        public int protectValue = 5;
        public int GetProtectNeedValue = 0;

        private bool isDead;
        public bool IsDead
        {
            get { return isDead; }
            set
            {
                isDead = value;
                if (value)
                {
                    this.Vis = System.Windows.Visibility.Collapsed;
                }
                OnPropertyChanged("IsDead");
            }
        }

        private System.Windows.Visibility vis;
        public System.Windows.Visibility Vis
        {
            get { return vis; }
            set { vis = value; OnPropertyChanged("Vis"); }
        }

        private System.Windows.Visibility protectLayer;
        public System.Windows.Visibility ProtectLayer
        {
            get { return protectLayer; }
            set { protectLayer = value; OnPropertyChanged("ProtectLayer"); }
        }

        private bool isProtect;
        public bool IsProtect
        {
            get { return isProtect; }
            set { isProtect = value; OnPropertyChanged("IsProtect"); this.ProtectLayer = value ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed; }
        }




        private double top;
        public double Top
        {
            get { return top; }
            set { top = value; OnPropertyChanged("Top"); }
        }

        private double left;
        public double Left
        {
            get { return left; }
            set { left = value; OnPropertyChanged("Left"); }
        }

        private double width;
        public double Width_
        {
            get { return width; }
            set { width = value; OnPropertyChanged("Width_"); }
        }

        private double height;
        public double Height_
        {
            get { return height; }
            set { height = value; OnPropertyChanged("Height_"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(string arg)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(arg));
            }
        }
    }
}
